package com.yegs.jindie.controller;

import com.yegs.jindie.entity.Msg;
import com.yegs.jindie.entity.UserConfigTO;
import com.yegs.jindie.serviceImpl.UserConfigServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/config")
public class UserConfigController {

    @Autowired
    private UserConfigServiceImpl userConfigService;

    @RequestMapping("/get")
    public Msg getUserConfig(){
        UserConfigTO userConfig = userConfigService.getUserConfig();
        return Msg.success("userConfig",userConfig);
    }

    @RequestMapping("/save")
    public Msg getUserConfig(@RequestBody() UserConfigTO userConfig){
        boolean save = userConfigService.save(userConfig);
        if(save){
            return Msg.success("保存成功!");
        }
        return Msg.error("保存成功!");
    }


}
